package com.example.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.Admin;
import com.example.entity.Orders;
import com.example.entity.TimeData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrdersDao extends BaseMapper<Orders> {
    @Select("select year(time) as year,SUM(total) AS total from orders GROUP BY year")
    public List<TimeData> getTotalByYear();

    @Select("select MONTH(time) as month,SUM(total) AS total from orders GROUP BY month")
    public List<TimeData> getTotalByMonth();

    @Select("select day(time) as day,SUM(total) AS total from orders GROUP BY day")
    public List<TimeData> getTotalByDay();

}
